package com.project.util;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

import com.project.entity.sys.User;


/**
 *  获取shiro当前用户
 *
 */
public class CurrentSessionUtil{
	
	/**
	 * 获取当前登录用户信息
	 * @return
	 */
	public static User getCurrentUser(){
		Subject currentUser = SecurityUtils.getSubject();//获取当前用户
		Session session = currentUser.getSession();
		User user = (User) session.getAttribute("user");
		
		return user;
	}

}
